package com.zoro.dyformservice.business.blog.entity;

import com.zoro.dyformservice.business.user.entity.UserInfoEntity;
import jakarta.persistence.Basic;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import org.hibernate.annotations.LazyGroup;

import java.util.Date;

@Entity
@Table(name = "df_user_blog")
public class UserBlog {

    @Id
    @Column(name = "blog_id")
    private String blogId;
    @Column(name = "blog_title")
    private String blogTitle;
    @Column(name = "create_date")
    private Date createDate;

    @Column(name = "blog_text")
    @Basic(fetch = FetchType.LAZY)
    @LazyGroup("lobs")
    private String blogText;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private UserInfoEntity userInfo;

    public UserInfoEntity getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfoEntity userInfo) {
        this.userInfo = userInfo;
    }

    public String getBlogId() {
        return blogId;
    }

    public void setBlogId(String blogId) {
        this.blogId = blogId;
    }

    public String getBlogTitle() {
        return blogTitle;
    }

    public void setBlogTitle(String blogTitle) {
        this.blogTitle = blogTitle;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getBlogText() {
        return blogText;
    }

    public void setBlogText(String blogText) {
        this.blogText = blogText;
    }

    @Override
    public String toString() {
        return "UserBlog{" +
                "blogId='" + blogId + '\'' +
                ", blogTitle='" + blogTitle + '\'' +
                ", createDate='" + createDate + '\'' +
                '}';
    }
}
